home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / freeentry.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  1KB  |  72 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: freeentry.c,v 1.4 1996/08/13 13:56:02 digulla Exp $
  4.     $Log: freeentry.c,v $
  5.     Revision 1.4  1996/08/13 13:56:02  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:11  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang:
  15. */
  16. #include "exec_intern.h"
  17. #include <aros/libcall.h>
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <exec/memory.h>
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(void, FreeEntry,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct MemList *, entry,A0),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 38, Exec)
  32.  
  33.  
  34. /*  FUNCTION
  35.     Free some memory allocated with AllocEntry().
  36.  
  37.     INPUTS
  38.     entry - The MemList you got from AllocEntry().
  39.  
  40.     RESULT
  41.  
  42.     NOTES
  43.  
  44.     EXAMPLE
  45.  
  46.     BUGS
  47.  
  48.     SEE ALSO
  49.     AllocEntry()
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.     18-10-95    created by m. fleischer
  55.  
  56. ******************************************************************************/
  57. {
  58.     __AROS_FUNC_INIT
  59.     ULONG i;
  60.  
  61.     /* First free all blocks in the MemList */
  62.     for(i=0;i<entry->ml_NumEntries;i++)
  63.     FreeMem(entry->ml_ME[i].me_Addr,entry->ml_ME[i].me_Length);
  64.  
  65.     /* Then free the MemList itself */
  66.     FreeMem(entry,sizeof(struct MemList)-sizeof(struct MemEntry)+
  67.           sizeof(struct MemEntry)*entry->ml_NumEntries);
  68.     __AROS_FUNC_EXIT
  69. } /* FreeEntry */
  70.  
  71.  
  72.